# Contributor: Francesco Zanini <francesco@zanini.me>
# Contributor: Katie Holly <holly@fuslvz.ws>
# Contributor: Mike Crute <mike@crute.us>
# Maintainer: Mike Crute <mike@crute.us>
pkgname=bird
pkgver=2.0.10
pkgrel=0
pkgdesc="BIRD Internet Routing Daemon"
url="https://bird.network.cz/"
arch="all"
license="GPL-2.0-or-later"
makedepends="bison flex ncurses-dev readline-dev linux-headers libssh-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-openrc"
source="
	$pkgname-$pkgver-2.tar.gz::https://bird.network.cz/download/bird-$pkgver.tar.gz
	bird-make-test-bsprintf.patch
	bird.initd
	bird.confd
	"

# flawed test on big-endian
case "$CARCH" in
	s390x) options="!check";;
esac

[ "$CARCH" = "riscv64" ] && options="$options textrels" # Temporarily allow textrels on riscv64

build() {
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-libssh
	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/bird.initd "$pkgdir"/etc/init.d/bird
	install -Dm644 "$srcdir"/bird.confd "$pkgdir"/etc/conf.d/bird
}

sha512sums="
607f9c96bbf55b7622a8c49126ad568ce9a220520801a13e89be63eee65a76c575a8095485e5bbd867d1306fed87c8394a82fe88d76307eaa40ee5902842d158  bird-2.0.10-2.tar.gz
e0a9bab1bb84ab4efbf51c4c015bf35196d146560f737979d3a17c44dc2397d9578e61a3bba0c58f3cdbb108074f17288bf536db5d8d4dce87c91f1be3dc6282  bird-make-test-bsprintf.patch
8d2f6c95d9ce218dd1e3cbc847b8c39584cdb336b2ba1484294e1f3894e5b03b0966a098b5820c2980ef486c04460cbdc71fefe915dc458c459dbd8e8e6a618f  bird.initd
22e9ce0a5b5aedd1fe7f9aeb2c5c327ff6df8fe8a42b7bc21194bab8ec16f68d99480507b97b74ea549b4cac4f51fedf7d488ccb4defa44dd90d7f3a63d667cf  bird.confd
"
